package com.bgamq.boot.controller;

import com.bgamq.boot.entity.Dept;
import com.bgamq.boot.entity.service.DeptService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class DeptController {

   /* //private static final  String REST_URL_PREFIX="http://localhost:8001";
    private static final String REST_URL_PREFIX="http://PROVIDER-DEPT";

    @Resource
    private RestTemplate restTemplate;*/
    @Resource
    private DeptService deptService;

    @RequestMapping(value = "/consumer/dept/add")
    public boolean add(Dept dept){
       return this.deptService.add(dept);
    }

    @RequestMapping(value = "/consumer/dept/get/{id}",method = RequestMethod.GET)
    public Dept get(@PathVariable("id") Long id){
       return this.deptService.get(id);
    }

    @RequestMapping(value = "/consumer/dept/list",method = RequestMethod.GET)
    public List<Dept> getList(){
       return this.deptService.getList();
    }

}
